/*
 * JBoss, Home of Professional Open Source
 *
 * Copyright 2008, Red Hat Middleware LLC, and individual contributors
 * by the @author tags. See the COPYRIGHT.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.netty.handler.codec.bayeux;

import java.util.Date;

/**
 * 
 * A Bayeux server MUST respond to a subscribe request with a subscribe response
 * message.
 *
 * A Bayeux server MAY send event messages for the client in the same HTTP
 * response as the subscribe response, including events for the channels just
 * subscribed to.
 *
 * A subscribe responses MUST contain the message fields:
 *   channel
 *     value "/meta/subscribe"
 *   successful
 *     boolean indicating the success or failure of the subscribe
 *   clientId
 *     The negotiated client ID
 *   subscription
 *     a channel name or a channel pattern or an array of channel names and channel patterns.
 *
 * A subscribe response MAY contain the message fields:
 *   error
 *   advice
 *   ext
 *   id
 *     same value as request message id
 *   timestamp
 *
 * An example successful subscribe response is:
 * [
 *   {
 *     "channel": "/meta/subscribe",
 *     "clientId": "Un1q31d3nt1f13r",
 *     "subscription": "/foo/**",
 *     "successful": true,
 *     "error": ""
 *   }
 * ]
 *
 * An example failed subscribe response is:
 * [
 *   {
 *     "channel": "/meta/subscribe",
 *     "clientId": "Un1q31d3nt1f13r",
 *     "subscription": "/bar/baz",
 *     "successful": false,
 *     "error": "403:/bar/baz:Permission Denied"
 *   }
 * ]

 * @author daijun
 */
public class SubscribeResponse extends BayeuxMessage  implements BayeuxInterface{
    //required
    //private String channel;
    //private boolean successful;
    //private String clientId;
    //private String subscription;

    //optional
    //private String error;
    //private BayeuxAdvice advice;
    //private BayeuxExt ext;
    //private String id;
    //private Date timestamp;

    public SubscribeResponse(SubscribeRequest subscribeRequest) {
        channel="/meta/subscribe";
        subscription=subscribeRequest.getSubscription();
        clientId=subscribeRequest.getClientId();
        id=subscribeRequest.getId();

    }

   

    @Override
    public boolean isValid(){
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
